import { defineStore } from "pinia"
import { piniaStore } from "@/store"

export const useUserStore = defineStore('user-store', {
    state: () => {
        return {
            userInfo: null,
        }
    },
    actions: {
        setUserInfo(data) {
            this.userInfo = data
        }
    },
    getters: {
        getUserInfo(state) {
            return state.userInfo
        }
    },
})

// 在js中使用pinia时需要导入这个函数
export const useUserStoreWithOut = () => {
    return useUserStore(piniaStore)
}
